package com.czq.cn.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czq.cn.entity.Product;
import com.czq.cn.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService extends ServiceImpl<ProductMapper, Product> implements com.czq.cn.service.ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public int addProduct(Product product) {
        return productMapper.insert(product);
    }

    @Override
    public int updateProduct(Product product) {
        return productMapper.updateById(product);
    }

    @Override
    public int delete(Long id) {
        return productMapper.deleteById(id);
    }

    @Override
    public Product detail(Long id) {
        return productMapper.selectById(id);
    }

    @Override
    public List<Product> getList() {
        return productMapper.selectList(null);
    }
}
